package Eyjafjalla.card.dolly;

import Eyjafjalla.action.EyjafjallaAttackAction;
import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.modcore.ColorEnum;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;

public class JMCPS_Eyjafjalla extends AbstractEyjafjallaCard {
    public static final String ID = "JMCPS_Eyjafjalla";
    private static final CardStrings cardStrings;

    public JMCPS_Eyjafjalla(){
        super(ID, cardStrings.NAME,1,cardStrings.DESCRIPTION,CardType.ATTACK, ColorEnum.Eyjafjalla_Dolly_COLOR,CardRarity.UNCOMMON,CardTarget.ENEMY);
        this.baseDamage = 9;
        this.damage =9;
        setDolly();
        setFireDescription(cardStrings.EXTENDED_DESCRIPTION[0]);
    }

    @Override
    public AbstractCard makeCopy() {
        return new JMCPS_Eyjafjalla();
    }

    @Override
    public void calculateCardDamage(AbstractMonster mo) {
        int realBase = baseDamage;
        if(mo!=null&&mo.getIntentDmg()>0){
            int extra = mo.getIntentDmg();
            baseDamage += isFire()?extra:0.5F*extra;
        }
        super.calculateCardDamage(mo);
        baseDamage = realBase;
        isDamageModified = baseDamage!=damage;
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new EyjafjallaAttackAction());
        addToBot(new DamageAction(m,new DamageInfo(p,damage,damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_HEAVY));
    }

    @Override
    public void upgrade() {
        if(!this.upgraded){
            upgradeName();
            upgradeDamage(4);
        }
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}



